home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / pdcurs21.zip / PORTABLE.ZIP / RESET_PR.C < prev    next >
Text File  |  1992-11-21  |  2KB  |  68 lines

  1. #include <string.h>
  2. #define        CURSES_LIBRARY  1
  3. #include <curses.h>
  4. #undef reset_prog_mode
  5.  
  6. #ifndef NDEBUG
  7. char *rcsid_reset_pr = "$Header: c:/curses/portable/RCS/reset_pr.c%v 2.0 1992/11/15 03:29:11 MH Rel $";
  8. #endif
  9.  
  10. /*man-start*********************************************************************
  11.  
  12.   reset_prog_mode()    - restore terminal mode
  13.  
  14.   X/Open Description:
  15.        Restore the terminal to "program" (in curses) or "shell" (out
  16.        of curses) state.  These are done automatically by endwin()
  17.        and doupdate() after an endwin(), so they would normally not
  18.        be called before these functions.
  19.  
  20.   PDCurses Description:
  21.        Under the Flexos platform, PDCurses operates in 16-bit mode.
  22.        Normally, the Flexos shell operates in 8-bit mode.
  23.  
  24.   X/Open Return Value:
  25.        The reset_prog_mode() routine returns OK on success otherwise ERR
  26.        is returned.
  27.  
  28.   Portability:
  29.        PDCurses        int reset_prog_mode( void );
  30.        X/Open Dec '88  int reset_prog_mode( void );
  31.        SysV Curses     int reset_prog_mode( void );
  32.        BSD Curses      int reset_prog_mode( void );
  33.  
  34. **man-end**********************************************************************/
  35.  
  36. int    reset_prog_mode(void)
  37. {
  38.        if      (c_pr_tty.been_set == TRUE)
  39.        {
  40. #if    defined(DOS) || defined(OS2)
  41. #  if  SMALL || MEDIUM
  42.        movedata( FP_SEG(&c_pr_tty.saved),              FP_OFF(&c_pr_tty.saved),
  43.                  FP_SEG(&_cursvar),    FP_OFF(&_cursvar),
  44.                  sizeof(SCREEN) );
  45. #  else
  46.                memcpy(&_cursvar, &c_pr_tty.saved, sizeof(SCREEN));
  47. #  endif
  48. #endif
  49.                mvcur(0, 0, c_pr_tty.saved.cursrow, c_pr_tty.saved.curscol);
  50.                if (PDC_get_ctrl_break() != c_pr_tty.saved.orgcbr)
  51.                        PDC_set_ctrl_break(c_pr_tty.saved.orgcbr);
  52.                if (c_pr_tty.saved.raw_out)
  53.                        raw();
  54.                if (c_pr_tty.saved.visible_cursor)
  55.                        curson();
  56.                _cursvar.font = PDC_get_font();
  57.                PDC_set_font(c_pr_tty.saved.font);
  58.                if (!PDC_scrn_modes_equal (PDC_get_scrn_mode(),  c_pr_tty.saved.scrnmode))
  59.                        PDC_set_scrn_mode(c_pr_tty.saved.scrnmode);
  60.  
  61.                PDC_set_rows(c_pr_tty.saved.lines);
  62.        }
  63. #ifdef FLEXOS
  64.        _flexos_16bitmode();
  65. #endif
  66.        return( OK );
  67. }
  68.